<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>商品详情</title>
	<!-- 公共样式 开始 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/base.css">
	<link rel="stylesheet" type="text/css" href="Resources/css/iconfont.css">
	<script type="text/javascript" src="Resources/framework/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Resources/layui/css/layui.css">
	<script type="text/javascript" src="Resources/layui/layui.js"></script>
	<!-- 滚动条插件 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/jquery.mCustomScrollbar.css">
	<script src="Resources/framework/jquery-ui-1.10.4.min.js"></script>
	<script src="Resources/framework/jquery.mousewheel.min.js"></script>
	<script src="Resources/framework/jquery.mCustomScrollbar.min.js"></script>	
	<script type="text/javascript" src="Resources/js/check.js"></script>
	<style>
			.layui-form-label{
				width: 100px;
			}
			.layui-input-block{
				margin-left: 130px;
			}
	</style>
	<base target="_parent" />
</head>
<body>
	<div class="cBody">
			<form id="addForm" class="layui-form" action="listProduct?status=update" method="post" enctype="multipart/form-data">
				<input type="hidden" name="gid" value="${good.gid}">
				<div class="layui-form-item">
					<label class="layui-form-label">商品ID</label>
					<div class="layui-input-block">
						<a class="layui-input">${good.gid}</a>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品名</label>
					<div class="layui-input-block">
						<input type="text" name="gname" value="${good.gName}" required lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品图片</label>
					<div class="layui-upload-drag" id="goodsPic">
						<input type="file" name="fUpload">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品分类</label>
	                <div class="layui-input-inline">
	                    <select name="provid" id="provid" lay-filter="provid">
	                        <option value="${good.catID}" >${cname}</option>
							<c:forEach items="${catlist}" var="cate" varStatus="st">
							<option value="${cate.catID}">${cate.catName}</option>
							</c:forEach>
	                    </select>
	                </div>
                </div>
				<div class="layui-form-item">
					<label class="layui-form-label">价格</label>
					<div class="layui-input-block">
						<input type="text" name="gprice" value="${good.gPrice}" required lay-verify="required|number" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">库存</label>
					<div class="layui-input-block">
						<input type="text" name="gnum" value="${num}" required lay-verify="required|number" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品信息</label>
					<div class="layui-input-block">
						<textarea class="layui-textarea" id="shopDetail" name="gmsg" style="display: none">${good.gMsg}</textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="submitBut">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
			
			<script>
				layui.use('layedit', function() {
					var layedit = layui.layedit,
						$ = layui.jquery;

					//构建一个默认的编辑器
					var index = layedit.build('shopDetail');

					//编辑器外部操作
					var active = {
						content: function() {
							alert(layedit.getContent(index)); //获取编辑器内容
						},
						text: function() {
							alert(layedit.getText(index)); //获取编辑器纯文本内容
						},
						selection: function() {
							alert(layedit.getSelection(index));
						}
					};

					$('.site-demo-layedit').on('click', function() {
						var type = $(this).data('type');
						active[type] ? active[type].call(this) : '';
					});
				});
				
			</script>
	</div>
</body>
</html>